﻿//------------------------------------------------------------
// 此脚本为工具自动生成，请勿直接修改。
//------------------------------------------------------------

using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;

// UIReuseItemKeys 注册
public static partial class UIReuseItemKeys
{
	public static readonly UIReuseItemKey PlantCardItem = new((view) => view.gameObject.GetOrAddComponent<PlantCardItem>());
}

public partial class PlantCardItem
{
	protected class Variable
	{
		public Image ImgCard;
		public Text TxtCD;
		public Text TxtPrice;

		public Variable(PlantCardItem script, UIReuseItem view) 
		{
			var variableHelper = view.GetVariableHelper();
			if (variableHelper == null)
			{
				Debug.LogError($"{view.name} 上找不到 UIVariableHelper 组件");
				return;
			}
			var variables = variableHelper.GetVariables();

			ImgCard = variables[0].GetComponent<Image>();
			TxtCD = variables[1].GetHotfixComponent<Text>();
			TxtPrice = variables[2].GetHotfixComponent<Text>();

		}
	}

	protected Variable m_UI;

	protected override void InitVariable(UIReuseItem view)
	{
		base.InitVariable(view);
		m_UI = new Variable(this, view);
		VariableInstance = m_UI;
	}

	protected override void OnItemEnable()
	{
		base.OnItemEnable();
		if (m_UI != null)
		{

		}
	}

	protected override void OnItemDisable()
	{
		// 注意：对于 lambda 表达式的监听器，无法直接移除
		// 由于 Variable 实例会在每次 Enable 时重新创建，旧的监听器会自动失效
		base.OnItemDisable();
	}
}

/*

*/

